﻿#pragma once

#include <log4lite/log_catagory.h>
#include <log4lite/Log_time.h>
#include <log4lite/t_string.h>
namespace log4lite {
	
	/// 日志项
	/// 表明一条日志内容
	class LogItem 
	{
	public:
		LogItem(LogCatagory lc, const tstring& message, const char* filename, int lineno)
			: _catagory(lc)
			, _message(message)
			, _filename(STRING_TO_TSTRING(filename))
			, _lineNo(lineno)
			, _timestamp(helpers::LogTime::gettimeofday())
			, _threadId(T_TEXT(""))
		{

		}

	public:
		const tstring& getMessage() const
		{
			return _message;
		}
		
		const tstring& getFilename() const
		{
			return _filename;
		}

		int getLineNo() const
		{
			return _lineNo;
		}

		LogCatagory getCatagory() const 
		{
			return _catagory;
		}

		helpers::LogTime getTimestamp() const 
		{
			return _timestamp;
		}

	private:
		LogCatagory		_catagory;  ///< 消息分类 见 #LogCatagory
		tstring			_message;	///< 消息内容
		tstring		_filename;	///< 消息所在文件
		int				_lineNo;	///< 消息所在行
		helpers::LogTime	_timestamp; ///< 时间戳
		tstring				_threadId;  ///< 线程ID
	};


} // namespace log
